<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/static/admin/jsp/include.jsp"%>
<script type="text/javascript">
	var id = "${id}";
	var submitForm = function($dialog, $grid, $pjq) {
		if ($('form').form('validate')) {
			var obj=sy.serializeObject($('form'));
			if (obj.birth != undefined) {
				obj.birth += ' 00:00:00';
			}
			obj.account = $("#account").textbox('getValue');
			alert(obj.account)
			var url=sy.contextPath + '/user/save';
			$.post(url, obj, function(result) {
				if (result.code == 0) {
					$grid.datagrid('reload');
					$dialog.dialog('destroy');
				} else {
					$pjq.messager.e('保存失败,'+result.msg);
				}
			}, 'json');
		}
	};
	
	$(function() {
		if (id != '') {
			parent.$.messager.progress({
				text : '数据加载中....'
			});
			$.post(sy.contextPath + '/user/findById', {
				id : id
			}, function(result) {
				if (result) {
					$('form').form('load', result);
				}
				parent.$.messager.progress('close');
			}, 'json');
			
			//$("#account").textbox({novalidate:true,readonly:true});
		}
	});
</script>
</head>
<body>
	<form id="form" method="post">
        <input name="id" type="hidden" />
        <div style="padding:15px;font-size: 12px">
            <table style="table-layout:fixed;" border="0" cellspacing="0" class="formtable">
		    	<tr>
		    		<th style="width:100px;">用户名(手机号)：</th>
		    		<td>
		    			<input id="account" name="account" class="easyui-textbox" missingMessage="请输入" prompt="请输入" style="width:90%;"
		    				data-options="required:true,validType:['mobile','unique[\'/user/isAccountExist\']']" />
		    		</td>
		    	</tr>
		    	<tr>
		    		<th style="width:100px;">昵称：</th>
		    		<td>
		    			<input id="nickName" name="nickName" class="easyui-textbox" missingMessage="请输入" prompt="请输入" style="width:90%;"
		    				data-options="required:true,validType:['length[0,20]']" />
		    		</td>
		    	</tr>
		    	<tr>
		    		<th style="width:100px;">性别：</th>
		    		<td>
		    			<input id="sex" name="sex" editable="false" class="easyui-combobox" style="width:90%;" panelHeight='auto' 
							data-options="valueField:'value',textField:'name',data: [{name:'女',value:'0'},{name:'男',value:'1'},{name:'未知',value:'2',selected:true}]" />
		    		</td>
		    	</tr>
		    	<tr>
		    		<th style="width:100px;">姓名：</th>
		    		<td>
		    			<input id="name" name="name" class="easyui-textbox" missingMessage="可选" prompt="可选" style="width:90%;"
		    				data-options="validType:['length[0,20]']" />
		    		</td>
		    	</tr>
		    	<tr>
		    		<th style="width:100px;">出生年月：</th>
		    		<td>
		    			<input id="birth" name="birth" class="easyui-datebox" missingMessage="可选" prompt="可选" style="width:90%;"
		    				data-options="editable:false" />
		    		</td>
		    	</tr>
		    	<tr>
		    		<th style="width:100px;">地址：</th>
		    		<td>
		    			<input id="address" name="address" class="easyui-textbox"  missingMessage="可选" prompt="可选" style="width:90%;height:50px;"
		    				data-options="multiline:true,validType:['length[0,100]']" />
		    		</td>
		    	</tr>
            </table>
        </div>
	</form>
</body>
</html>